/**
*  Copyright 2002 Sun Microsystems, Inc. All rights reserved.
*/

/**
 *Title MyPoint
 * @author xiaofei
 *@version 1.0
 */
package mypoint;
public class MyPoint {
	protected int x;
	protected int y;
	public MyPoint()
	{
		this.x = 0;
		this.y = 0;
	}	
	public MyPoint(int x, int y)
	{
		this.x = x;
		this.y = y;
	}
	public void setX(int x)
	{
		this.x = x;
	}
	public void setY(int y)
	{
		this.y = y;
	}
	public int getX()
	{
		return this.x;
	}
	public int getY()
	{
		return this.y;
	}
	public void setXY(int x, int y)
	{
		this.x = x;
		this.y = y;
	}
	public String toString()
	{
		return "The point is (" + this.x + "," + this.y + ");" ;
	}
	public double distance(int x, int y)
	{
		int xDiff = this.x - x;
		int yDiff = this.y - y;
		return Math.sqrt(xDiff * xDiff + yDiff * yDiff);
	}
	public double distance(MyPoint point)
	{
		int xDiff = this.x - point.x;
		int yDiff = this.y - point.y;
		return Math.sqrt(xDiff * xDiff + yDiff * yDiff);
	}
}
